package com.spring.controller.javastack.form;

import com.base.annotations.Token;
import com.spring.controller.ApiModel;
import com.spring.controller.BaseController;
import com.spring.controller.dto.order.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by chenhs on 2018/6/16.
 */
@Controller
@RequestMapping("/repeat")
public class TestRepeatController extends BaseController {

    @Token(create = true)
    @RequestMapping("/preSubmit")
    public ModelAndView preSubmit() {
        return new ModelAndView("/javastack/submit");
    }

    @Token(remove = true)
    @RequestMapping("/save")
    @ResponseBody
    public ApiModel save(String name, String pwd) {
        User user = new User(name, pwd);
        System.out.println(user.getName() + ", " + user.getPwd());

        return buildSuccMsg(user);
    }

}
